package org.wangchaocheng.cloudgallery.user.executor.query;

import lombok.RequiredArgsConstructor;
import org.wangchaocheng.cloudgallery.common.annotation.QueryExecutor;
import org.wangchaocheng.cloudgallery.dto.user.UserDTO;
import org.wangchaocheng.cloudgallery.user.gateway.UserGateway;

/**
 * 用户信息查询执行器
 *
 * @author wangchaocheng
 * @date 2025/04/01
 */
@QueryExecutor
@RequiredArgsConstructor
public class UserQryExe {

    private final UserGateway userGateway;

    public UserDTO execute(Long userId) {
        return userGateway.findByColumn(UserDTO::getId, userId);
    }

    public UserDTO execute(String username) {
        return userGateway.findByColumn(UserDTO::getUsername, username);
    }
}
